﻿using System.Collections;
using System.Collections.Generic;

namespace gbL.NetBoard.Examples.DoubleMVC.View.Data
{
    /// <summary>
    /// Miha Markič
    /// http://cs.rthand.com/blogs/blog_with_righthand/archive/2006/01/15/284.aspx (23 March 2010)
    /// </summary>
    /// <typeparam name="T"></typeparam>
    internal class LinqList<T> : IEnumerable<T>, IEnumerable
    {
        IEnumerable items;

        internal LinqList(IEnumerable items)
        {
            this.items = items;
        }

        IEnumerator<T> IEnumerable<T>.GetEnumerator()
        {
            foreach (T item in items)
                yield return item;
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            IEnumerable<T> ie = this;
            return ie.GetEnumerator();
        }
    }
}
